It is known that magnetic sensors or detector elements can be used for establishing and recording the occurrence of magnetic fields and it is also known that magnetic markings can be arranged on a carrier which are readable by magnetic sensors. If a magnetic sensor of known type is used for the detection of magnetic markings which have been applied to e.g. a packaging material web in order to control the forwards feed of the web or control some other working operation, difficulties frequently occur owing to the presence of strong magnetic interference fields. In a packaging machine, for example, sealings are carried out frequently with the help of induction coils which are supplied with heavy currents and which induce strong magnetic fields. Similarly, in modern machines electric machines, e.g. motors and transformers, are present which give rise to substantial magnetic fields. In the European patent no. 317879, it is described a method and arrangement for suppressing the effect of magnetic interference fields during the detection of magnetic marks or markings applied on a carrier. However, there is a need for an improved position detection for determining a position of a packaging material.